package edu.gyc.homework;

import java.util.Scanner;

public class juzhen {
    static void f(int n) {
        int[][] jz = new int[n][n];
        for (int row = 0; row < n; row++) {

            for (int col = 0; col < n; col++) {
                int data=row+col+1;
                if(data<=n){
                    jz[row][col]=data;
                }else {
                    jz[row][col]=data%n;
                }
            }
        }

        for(int row = 0;row < jz.length;row++){
            for(int col = 0;col < jz[row].length;col++){
                System.out.print(jz[row][col]+" ");
            }
            System.out.println();
        }
    }

    public static void main(String[] args) {
        System.out.println("Input a n:");
        Scanner scanner = new Scanner(System.in);
        int n=scanner.nextInt();
        f(n);
    }
}
